﻿<GroupBox Title="日志列表" Style="@($"height: {Height};border: 1px solid #096bc7 !important; display: flex; flex-direction: column;")">
    @if (logs.Any())
    {
        <div class="log-container">
            <div class="log-list">
                @foreach (var log in logs)
                {
                    var logId = $"log-{log.Timestamp.Ticks}";
                    <div class="log-item @GetLogLevelClass(log.Level)">
                        <div class="log-time">@log.Timestamp.ToString("HH:mm:ss")</div>
                        <div class="log-message" 
                             id="@logId"
                             data-bs-toggle="tooltip" 
                             data-bs-placement="top" 
                             title="@log.Message"
                             @onmouseover="() => ShowTooltip(logId, log.Message)"
                             @onmouseout="() => HideTooltip(logId)">
                            @TruncateMessage(log.Message)
                        </div>
                        @* @if (log.Exception != null)
                        {
                            <div class="log-exception">@log.Exception.Message</div>
                        } *@
                    </div>
                }
            </div>
        </div>
        
        <!-- 半透明浮动清空按钮 -->
        <div class="floating-clear-btn @(isButtonFixed ? "fixed-middle" : "")" style="@buttonPositionStyle">
            <button class="btn btn-danger btn-circle" @onclick="ClearLogs" title="清空日志">
                <i class="fas fa-trash"></i>
            </button>
        </div>
    }
    else
    {
        <div class="text-muted text-center p-3">暂无日志</div>
    }
</GroupBox>

@code {
    // 按钮定位相关状态变量在LogDrawer.razor.cs中定义
}
